home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tricks of the Mac Game Programming Gurus
/
TricksOfTheMacGameProgrammingGurus.iso
/
More Source
/
Libraries
/
SAT 2.3b4
/
Tutorial ƒ
/
Assignment4.p
< prev
next >
Wrap
Text File
|
1995-05-01
|
965b
|
50 lines
program Assignment4;
uses
{$ifc UNDEFINED THINK_PASCAL}
Types, QuickDraw, Menus, Windows, TextEdit, Fonts, Dialogs, Memory, OSEvents, {}
{$endc}
SAT;
var
ignore: SpritePtr;
var
direction: Integer;
procedure HandleSprite (me: SpritePtr);
begin
me^.position.h := me^.position.h + direction;
if me^.position.h <= 0 then
direction := 1;
if me^.position.h >= 200 then
direction := -1;
end; {HandleSprite}
procedure SetupSprite (me: SpritePtr);
begin
me^.task := @HandleSprite;
me^.face := SATGetFace(128);
direction := 1;
end; {SetupSprite}
const
kTicksPerFrame = 2;
var
t: Longint;
begin
{If we don't use Think Pascal, we must make standard inits ourselves.}
{$ifc UNDEFINED THINK_PASCAL}
SATInitToolbox;
{$endc}
SATInit(128, 129, 478, 302);
ignore := SATNewSprite(0, 200, 200, @SetupSprite);
while not Button do
begin
t := TickCount;
SATRun(true);
while TickCount < t + kTicksPerFrame do
;
end;
end.